﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BartonExtension;

namespace SqliteWrapper.Query
{
    public enum Order
    {
        Desc,
        Asc
    }
    public class QueryOrder
    {
        public string orderAttributes { get; set; }
        public Order orderType { get; set; }

        public QueryOrder() { }

        public QueryOrder(Order order, params string[] orderStr)
        {
            orderAttributes = "";
            foreach (string str in orderStr)
            {
                orderAttributes += "{0},".FormatWith(str);
            }
            orderAttributes.TrimEnd(',');
            orderType = order;
        }

        public string GetOrderBy()
        {
            string orderBy = "order by ";
            orderBy += orderAttributes;
            if (orderType == Order.Desc)
            {
                orderBy += " desc";
            }
            return orderBy;
        }
    }
}
